function TS = subtractTS(ts1, ts2)
% TS = subtractTS(ts1, ts2)  Subtract ts2 from ts1, element by
% element (ts1 - ts2).  If ts2 is a scalar then subtract ts2 from
% each element of ts1.
%

TS = ts1;

if isstruct(ts2)
    TS.data = ts1.data - ts2.data;
else
    if isstruct(ts1);
        TS.data = ts1.data - ts2;
    else
        TS = ts1 - ts2;
    end
end

return
